<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.text.Format"%>
<%@page import="firstping.model.Domain"%>
<%@page import="java.util.List"%>
<%@page import="firstping.model.Customer"%>
<%
	String title = (String) request.getAttribute("title");
	String description = (String) request.getAttribute("description");
	String keywords = (String) request.getAttribute("keyword");

	List<Domain> domains = (List<Domain>) request
			.getAttribute("domains");
%>
<jsp:include page="layout/header.jsp">
	<jsp:param name="title" value="<%=title %>" />
	<jsp:param name="description" value="<%=description %>" />
	<jsp:param name="keywords" value="<%=keywords %>" />
</jsp:include>
<div id="mainpage">
	<div id="maincontent">
		<h1>Account information</h1>

		<div class="box-wrapper">
			<div class="accountinfo">
				<div class="leftside">
					<table class="table-style style-colorstripes">
						<thead>
							<tr>
								<th>#</th>
								<th>Name</th>

								<th>Time</th>
								<th>Delete</th>
							</tr>
						</thead>
						<%
							if (domains.size() > 0) {
						%>
						<tbody>
							<%
								for (int i = 0; i < domains.size(); i++) {
							%>
							<tr <%=(i%2==0)?"class=\"odd\"":"" %> >
								<td><%=(i + 1)%></td>

								<td><a
									href="/view/<%=domains.get(i).getName()
							.replaceAll("http://", "")%>"><%=domains.get(i).getName()%></a>
								</td>
								<td>
									<%
										Format formatter = new SimpleDateFormat("MM/dd/yy h:m:s");
												String s = formatter.format(domains.get(i).getUpdate());
												out.print(s);
									%>
								</td>
								<td><a href="/delete?name=<%=domains.get(i).getName()%>"
									onclick="javascript:if(confirm('Do you want delete ?'))return true;else return false;"><img
										src="/images/delete_icon.gif" /> </a>
								</td>
							</tr>
							<%
								}
							%>
						</tbody>
						<%
							}
						%>
					</table>
				</div>
				<div class="rightside">
					<h2>My Account</h2>
					<ul>

						<li class="subinfo"><strong>Exp date</strong> : <%
							Format formatter = new SimpleDateFormat("MM/dd/yy");
							String s = formatter.format(session.getAttribute("exp"));
							out.print(s);
						%> <br /> <strong>Type</strong> : <%=session.getAttribute("type")%>
							<br /> <strong>Request</strong> : <%=session.getAttribute("req")%>
							Minutes <a class="button-style" href="/update">Update Account</a>
						</li>
						<li><a href="/account">Account</a></li>
						<li><a href="/add-site">Add site</a></li>
						<li><a href="/change-password">Change password</a></li>
						<li><a href="/logout">Logout</a></li>
					</ul>
				</div>

				<div class="clearbreak"></div>
			</div>
		</div>
	</div>
</div>

<jsp:include page="/layout/footer.jsp">
	<jsp:param name="language" value="1" />
</jsp:include>
